package cn.com.support.context;

import cn.com.dal.dataobject.hr.UserDO;
import cn.com.support.SessionKeeper;

/**
 * 用户上下文
 * 
 * @since 2012-3-9 上午1:02:58
 * @version 1.0
 * @author Microbun
 */
public class UserContext {
	
	public static String getUsername() {
		return ((UserDO)(RunData.get().getHttpSession().getAttribute(SessionKeeper.USER_DETAIL))).getUsername();
	}

	public static String getNickname() {
		return ((UserDO)(RunData.get().getHttpSession().getAttribute(SessionKeeper.USER_DETAIL))).getNickname();
	}

	public static String getPassword() {
		return ((UserDO)(RunData.get().getHttpSession().getAttribute(SessionKeeper.USER_DETAIL))).getPassword();
	}

	public static String getAutthorization() {
		return ((UserDO)(RunData.get().getHttpSession().getAttribute(SessionKeeper.USER_DETAIL))).getExtendAuthorization();
	}
	
	public static UserDO getUser(){
		return ((UserDO)(RunData.get().getHttpSession().getAttribute(SessionKeeper.USER_DETAIL)));
	}
	
	public static void setUser(UserDO userDO){
		RunData.get().getHttpSession().setAttribute(SessionKeeper.USER_DETAIL, userDO);
	}
}
